#include <unistd.h>
#include <signal.h>
#include <stdio.h>

void handler(int signo){
    if(signo == SIGINT){
        printf("received SIGINT\n");
    }

    if(signo == SIGQUIT){
        printf("received SIGQUIT\n");
    }
}

int main(){
    int pid = getpid();
    printf("pid is %d\n", pid);
    //注册SIGINT信号处理
    signal(SIGINT,handler);
    //注册SIGQUIT信号处理
    signal(SIGQUIT,handler);
    while(1) pause();
    return 0;
}